<extend name="base/Base" />
<block name="Style">
<!-- FooTable Plugin CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/vendor/plugins/footable/css/footable.core.min.css">
		<!-- Admin Forms CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/assets/admin-tools/admin-forms/css/admin-forms.css">
	
</block>
<block name="Topbar">
								
   <header id="topbar" class="ph10">
        <div class="topbar-left">
          <ul class="nav nav-list nav-list-topbar pull-left">
           
		  
		 	<li     >
              <a href="__APP__/Research/Auth/Manage.html"    >授权调研</a>
            </li>
			 <li    >
              <a href="#"  data-toggle="modal" data-target="#usermyModal"    >增加用户</a>
            </li> 
			<!-- <li    class="active">
              <a  href="__APP__/Admin/User/Manage.html"   >用户管理</a>
            </li>
			 
           -->
          </ul>
        </div> 
		<div class="topbar-right hidden-xs hidden-sm">
		  <a href="#"  onclick="selectAll()" class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star pr5"></span>全选</a>
			 <a href="#"   onclick="unSelect()"  class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star-o pr5"></span>不选</a>
			 <a href="#"    onclick="reverse()"class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star-half-o pr5"></span>反选</a>
			  
			
			
			  <a href="#" onclick="status(1)" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-lock pr5"></span>全部权限</a>
			 <a href="#" onclick="status(0)" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-lock pr5"></span>删除</a>
			 
			 
						  
          
        </div>
	</header>
	
	<div class="modal fade" id="usermyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
									  <div class="modal-dialog" role="document">
										<div class="modal-content">
										  <div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
											<h4 class="modal-title" id="myModalLabel">增加用户</h4>
										  </div>
										  <div class="modal-body">
											 <div class="form-group">
												<label for="exampleInputEmail1">请输入用户UID</label>
												<input type="text" name="to_uid" id="to_uid" class="form-control"  placeholder="请输入用户UID">
											  </div>
											  
										
											 
											  
											
											
														
														
														
													
												
																
						
										  </div>
										  <div class="modal-footer">
											<button type="button" class="btn btn-default" data-dismiss="modal">关闭页面</button>
											<a href="#" class="btn btn-primary" onclick="relevance()" >确认操作</a>
															<script>
						
							
							function relevance(){  
								var to_uid = $("#to_uid").val();
								
								if(to_uid==''){
								
									layer.msg('请输入用户UID');
								
								}else{
								
									
									$.ajax({
										type:'POST',
										url:"__APP__/Research/Auth/Create.html",
										data:{
											"to_uid": to_uid,
											"form_id": {$form_id},
											
										},
										success:function(data){			
											var info = eval(data)
											if (info.errcode == 0) {
											
												layer.msg(info.errmsg);
												setTimeout(window.location.reload(),3000);
												
											}else{
												layer.msg(info.errmsg);
											}
										},
								
									});	
								
								}
								
								
								 
							}  
							</script>
										  </div>
										</div>
									  </div>
									</div>
	
				
</block>
<block name="Content">
	<!-- begin: .tray-center -->
        <div class="tray tray-center">

						
         	<script>
						
					function notice(msg){  
						layer.msg(msg);
					}	
							
							
							</script>
          <!-- recent orders table -->
          <div class="panel">
            <div class="panel-menu p12 admin-form theme-primary">
			
			
              <div class="row">
              </div>
            </div>
            <div class="panel-body pn" id="batchstatus">
			

              <div class="table-responsive">
                <table class="table footable"  data-filter="#fooFilter"  data-page-navigation=".pagination" data-page-size="100" >
                  <thead>
                    <tr class="bg-light"> 
					 
				<th style="width:5%">批量</th>
					 <th style="width:5%">#</th>
                     
					
                      <th data-hide="phone,tablet">姓名</th>
                      <th data-hide="phone,tablet">增(表单)</th>
                      <th data-hide="phone,tablet">改</th>
                      <th data-hide="phone,tablet">查</th>
                      <th data-hide="phone,tablet">删</th>
					  <th data-hide="phone,tablet">增(字段)</th>
                      <th data-hide="phone,tablet">改</th>
                      <th data-hide="phone,tablet">查</th>
                      <th data-hide="phone,tablet">删</th>
					  <th data-hide="phone,tablet">增(信息)</th>
                      <th data-hide="phone,tablet">改</th>
                      <th data-hide="phone,tablet">查</th>
                      <th data-hide="phone,tablet">删</th>
                      					
                      
                    </tr>
                  </thead>
                  <tbody>
				  <volist name="list" id="list">
                    <tr>
						<td class="text-center">
						
						<center>
						<label class="option block mn">
						  <input type="checkbox" id="batch" name="batch" value="{$list.id}">
						
						</label>
						</center>
						
													
														
														
													  </td>
						<td class="">{$i}</td>
                      
                 
				
					  <td >{$list.to_uid|getUserNicknameByUID}</td>
					  <td > 
					  <if condition="$list.create_form eq 1"> 
						<a onclick="change('{$list.id}',1,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',1,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.edit_form eq 1"> 
						<a onclick="change('{$list.id}',2,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',2,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.find_form eq 1"> 
						<a onclick="change('{$list.id}',3,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',3,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.delete_form eq 1"> 
						<a onclick="change('{$list.id}',4,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',4,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.create_field eq 1"> 
						<a onclick="change('{$list.id}',5,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',5,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.edit_field eq 1"> 
						<a onclick="change('{$list.id}',6,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',6,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.find_field eq 1"> 
						<a onclick="change('{$list.id}',7,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',7,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.delete_field eq 1"> 
						<a onclick="change('{$list.id}',8,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',8,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.create_info eq 1"> 
						<a onclick="change('{$list.id}',9,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',9,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.edit_info eq 1"> 
						<a onclick="change('{$list.id}',10,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',10,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.find_info eq 1"> 
						<a onclick="change('{$list.id}',11,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',11,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					   <td > 
					  <if condition="$list.delete_info eq 1"> 
						<a onclick="change('{$list.id}',12,0)" class="btn btn-success btn-xs">有权限</a>
					  
					  <else /> 
					  <a onclick="change('{$list.id}',12,1)"  class="btn btn-danger btn-xs">无权限</a>
					  
					  </if>
					  
					  </td>
					 
                      
							
                           
                      
                    </tr>
                </volist>
				</tbody>
				 <tfoot class="footer-menu">
				<tr>
				  <td colspan="12">
					<nav class="text-right">
					  <ul class="pagination hide-if-no-paging"></ul>
					</nav>
				  </td>
				</tr>
			  </tfoot>
                </table>
              </div>
            </div>
          </div>

		  
				<div class="col-md-12 digg">
				 <br>
					<center>
				 {$pages}
				</center>
				
			  </div>
			  
        </div>
        <!-- end: .tray-center -->

       
   

</block>
<block name="Script">
	
  <!-- FooTable Plugin -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.all.min.js"></script>
   <!-- FooTable Addon -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.filter.min.js"></script>

 <script type="text/javascript">
 
	
		function unSelect(){
				
		  $("input[id='batch']").each(function(){
		   $(this).prop("checked",false);
		  });  
		  
	
		}
		
		function selectAll(){
				
		 $("input[id='batch']").each(function(){
		   $(this).prop("checked",true);
		  });  
		  
		}
		
		function reverse(){
				
		 $("input[id='batch']").each(function(){
			$(this).prop("checked",!this.checked);   
		  
			})
		}
		
			
				function change(id,type,status){
				
				
						
						  $.ajax({
								type:'POST',
								url:"__APP__/Research/Auth/change.html",
								data:{
									
									"id": id,
									"type": type,
									"status": status,
									
								},
								success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
								},
								error:function(){
									layer.msg('系统繁忙,请稍候重试！');
								}
							
							});	 
						  
						
					
				
				}
				
				
			
		
				function status(status){
				
				
						 var id=$('input[id="batch"]:checked').map(function(){return this.value}).get().join();
						
						layer.confirm('你确定要这样做么？', {
						  btn: ['确定','取消'] //按钮
						}, function(){
						  
						  $.ajax({
								type:'POST',
								url:"__APP__/Research/Auth/Status.html",
								data:{
									
									"id": id,
									"status": status,
									
								},
								success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
								},
								error:function(){
									layer.msg('系统繁忙,请稍候重试！');
								}
							
							});	 
						  
						}, function(){
						  
						  
						});

					
				
				}
				
				
					
					
					
						$("#status").change(function(){
						  	var status = $("#status").val();
							
							
							var url = '__APP__/Admin/User/Manage.html';
							url = url+'?status='+status;
						
							 self.location=url;
							
						
						
					});
					
						
					
  jQuery(document).ready(function() {

 

    // Init FooTable Examples
    $('.footable').footable();


  });
  </script>
</block>